/*
<h3>全局常量</h3>
<table class="table table-bordered">
    <thead class="thead-light">
    <tr>
        <th>属性</th>
        <th>类型</th>
        <th>值</th>
        <th>说明</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>_UNICODE</td>
        <td>Boolean</td>
        <td></td>
        <td>编译的super duilib 库是否为Unicode版本</td>
    </tr>
    </tbody>
</table>
*/

$(document).ready(function(){
  function getHtml(data, idx) {
    var html = '<div class="card"><div class="card-header"><a class="card-link" data-toggle="collapse" href="#collapse';
    html += idx +'">' + data.name + '</a></div>';
    html += '<div id="collapse' + idx + '" class="collapse" data-parent="#accordion">';
    html += '<table class="table table-bordered"><thead class="thead-light"><tr>';
    for(var i = 0, lenh = data.head.length; i < lenh; ++i) {
      html += '<th>' + data.head[i] + '</th>';
    }
    html += '</tr></thead><tbody>';
    for(var i = 0, len = data.data.length; i < len; ++i) {
      html += '<tr>';
      for(var j = 0, len1 = data.data[i].length; j < len1; ++j) {
        html += '<td colspan="' + lenh/len1 + '">' + data.data[i][j] + '</td>';
      }
      html += '</tr>';
    }
    html += '</tbody><table></div></div>';
    return html;
  }
  function addItem(html) {
    html = '<div class="container">' + html + '</div>';
    $('#content').append(html);
  }
  
  for(var i = 0, len = data.length; i < len; ++i) {
    var html = getHtml(data[i], i);
    addItem(html);
  }
});